{include file="common/_meta" /}
<title>糖果机列表</title>
</head>
<body class="pos-r">
    <nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页 <span class="c-gray en">&gt;</span> 系统设置 <span class="c-gray en">&gt;</span> 转账设置 <a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a></nav>
    <div class="page-container">
        <form class="Huiform" method="get" action="" >
        <div class="text-c"> 
    <!--        状态：
            <span class="select-box inline">
                <select name="status" class="select">
                    <option value="0" >生产中</option> 
                    <option value="1" style="color:green;">已完成</option>
                </select>
            </span>
            &nbsp;&nbsp;
            <input type="text" class="input-text" style="width:250px" placeholder="会员姓名、手机号" id="" name="keywords" value="{$Request.get.keywords|default=''}">
            <input type="text" class="input-text" style="display: none;" placeholder="" name="page" value="1">
            <button type="submit" class="btn btn-success radius" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 搜索</button> -->
        </div>
        </form>
        <div class="cl pd-5 bg-1 bk-gray mt-20"><span class="r">共有数据：<strong>{$list->total()}</strong> 条</span> </div>
        <div class="mt-20">
            <table class="table table-border table-bg table-hover table-sort">
                <thead>
                    <tr class="text-c">
                        <th ><input name="" type="checkbox" value=""></th>
                        <th >ID</th>
                        <th>转账类型</th>
                        <th>转账基数（最低转账）</th> 
                        <th>状态</th>                      
                        <th>操作</th>
                    </tr>
                </thead>
                <tbody>
                    {volist name="list" id="vo"}
                    <tr class="text-c va-m">
                        <td><input name="" type="checkbox" value=""></td>
                        <td>{$i}</td>
                        <td>{:config('coinText.'.$vo.from)} 转 {:config('coinText.'.$vo.to)}</td>
                        <td>{$vo.mini_base}</td>
                        <td>
                            {if condition="$vo.status eq 1"}
                            <span class="label label-success radius">开启</span>
                            {else/}
                            <span class="label label-error radius">关闭</span>
                            {/if}
                        </td>
                        <td class="td-manage">
                            <a style="text-decoration:none" href="javascript:;" onClick="modifyStatus(this, {$vo.id})" title="开启关闭">
                                <i class="Hui-iconfont">&#xe6df;</i>
                            </a>
                        </td>
                    </tr>
                    {/volist}
                </tbody>
            </table>
            <div class="pages" style="margin:20px;float: right; ">{$list->render()}</div>
        </div>


        <div id="cm_edit" class="modal fade" style="margin: 0 auto;" tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
         aria-hidden="true">
            <div class="modal-dialog">
                <div class="modal-content radius">
                    <div class="modal-header">
                        <h3 class="modal-title"></h3>
                        <a class="close" data-dismiss="modal" aria-hidden="true" href="javascript:void();">×</a>
                    </div>
                    <div class="modal-body">
                        <article class="page-container" style="padding-right: 10%;">
                            <form action="" method="post" class="form form-horizontal" id="form-user-add">
                                <div class="row cl hidden">
                                    <label class="form-label col-xs-4 col-sm-3"></label>
                                    <div class="formControls col-xs-8 col-sm-9">
                                        <input type="text" name="id" id="id" class="input-text" placeholder="" autocomplete="off">
                                    </div>
                                </div>
                                <div class="row cl">
                                    <label class="form-label col-xs-4 col-sm-3">转账基数：</label>
                                    <div class="formControls col-xs-8 col-sm-9">
                                        <input type="text" name="mini_base" id="mini_base" class="input-text" autocomplete="off">
                                    </div>
                                </div>
                                <div class="row cl">
                                    <label class="form-label col-xs-4 col-sm-3">转账状态：</label>
                                    <div class="radio-box">
                                        <input name="status" type="radio" value="1" id="">
                                        <label for="sex-1">开启</label>
                                    </div>
                                    <div class="radio-box">
                                        <input type="radio" value="0" id="" name="status">
                                        <label for="sex-2" class="c-red">关闭</label>
                                    </div>
                                </div>
                                
                                <div class="row cl">
                                    <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                                        <input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
                                    </div>
                                </div>
                            </form>
                        </article>
                    </div>
                </div>
            </div>
    </div>

    </div>
</div>
{include file="common/_footer" /}
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">
$('select[name="status"]').val('{$Request.get.status|default=0}');

function modifyStatus(obj, index)
{
    $.get("{:url('trans')}", {id:index}, function(data){
        $('#id').val(data.id);
        $('#mini_base').val(data.mini_base);
        $(':radio[value='+data.status+']').attr('checked', true);
    });
    $("#cm_edit").modal("show");
}

$(':submit').click(function(){

    $.post("{:url('trans')}", $('form').serialize(), function(data){
        layer.msg(data.msg);
        if (data.code) {
            setTimeout(function(){
                history.go(0);
            }, 500);
        }
    });

    return false;
});

</script>
</body>
</html>